<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"/>
    <title>雅怡居后台管理系统</title>
    <link href="../assets/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../assets/js/jquery-1.8.1.min.js"></script>
    <!--[if IE]>
    <script src="../assets/js/html5.js"></script>
    <![endif]-->
    <!--[if lte IE 6]>
    <script src="../assets/js/DD_belatedPNG_0.0.8a-min.js" language="javascript"></script>
    <script>
        DD_belatedPNG.fix('div,li,a,h3,span,img,.png_bg,ul,input,dd,dt');
    </script>
    <![endif]-->
</head>
<body class="loginbody">
<div class="dataEye">
    <div class="loginbox">
        <div class="logo-a">
            <a href="" title="雅怡居后台">
            </a>
        </div>
        <div class="login-content">
            <div class="loginbox-title">
                <h3>登录</h3>
            </div>
            <form id="signupForm">
                <div class="login-error"></div>
                <div class="row">
                    <input type="text" class="input-text-user input-click" name="mobile" id="mobile"/>
                </div>
                <div class="row">
                    <input type="password" class="input-text-password input-click" name="password" id="password"/>
                </div>
                <div class="row btnArea">
                    <a class="login-btn" id="submitLogin" >登录</a>
                </div>
            </form>
        </div>
    </div>

</div>
<div class="loading">
    <div class="mask">
        <div class="loading-img">
            <img src="../assets/images/loading.gif" width="31" height="31"/>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(".loading").hide();
    $("#submitLogin").click(function () {
        var mobile = $('[name="mobile"]').val();
        var password = $('[name="password"]').val();
        if (mobile === undefined || mobile.length == 0) {
            alert("手机号不能为空!");
            return false;
        }
        if (password === undefined || password.length == 0) {
            alert("密码不能为空!");
            return false;
        }
        var data = {
                "mobile":mobile,
                "password":password
        };
        $.ajax({
            url: "/backend/login",
            dataType:"json",
            contentType:"application/json;charset=utf-8",
            type:"post",
            data:JSON.stringify(data),
            beforeSend : function() {
                $('.loading').show();
            },
            success: function(data){
                console.log(data);
                $('.loading').hide();
                if( data.rc === 1)
                    location.href = "/page/index";
                else
                    alert(data.msg);
            }
        });

    })
</script>
</body>
</html>